package com.xmg.p2p.base.query;

import com.xmg.p2p.base.util.DateUtil;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.util.StringUtils;

import java.util.Date;

/**
 * Created by zsl on 2017/10/27.
 */

public class IplogQueryObject extends QueryObject {

	private Date beginDate;
	private Date endDate;
	private int state=-1;
	private  String username;
	private int userType = -1;

	public Date getBeginDate() {
		return beginDate;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public Date getEndDate() {
		return endDate==null?null: DateUtil.endOfDay(endDate);
	}


	public String getUsername() {
		return StringUtils.hasLength(username)?username:null;
	}

	@DateTimeFormat(pattern = "yyyy-MM-dd")
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}


	@DateTimeFormat(pattern = "yyyy-MM-dd")
	public void setBeginDate(Date beginDate) {
		this.beginDate = beginDate;
	}

	public int getUserType() {
		return userType;
	}

	public void setUserType(int userType) {
		this.userType = userType;
	}
}
